<?php

header("Cache-Control: no-cache, must-revalidate"); 
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); 
require("../config.php");
include_once("functii.php");

if(isset($_GET['obiect']))
 $id = addentities($_GET['obiect']);
 else
 $id = "";

 $mod = addentities($_GET['mod']);

if($id != "") {
	$rez1 = mysql_fetch_array(mysql_query("SELECT * FROM cladiri WHERE id = '$id'"));
	$nume_cladire = $rez1["nume"];
    $rez2 = mysql_fetch_array(mysql_query("SELECT * FROM c_cladiri WHERE id = '$nume_cladire'"));	
	$nivel_cladire = $rez1["nivel"];
	$nivel_upgrade = $nivel_cladire+1;
	$minerale = mysql_fetch_row(mysql_query("SELECT minerale FROM planete WHERE id = '$planeta'"));
    $gaz = mysql_fetch_row(mysql_query("SELECT gaz FROM planete WHERE id = '$planeta'"));
	$cost_minerale = round(formula_incrementare($rez2["cost_minerale"], $nivel_upgrade, $rez2["form_inc_minerale"], ""));
	$cost_gaz = round(formula_incrementare($rez2["cost_gaz"], $nivel_upgrade, $rez2["form_inc_gaz"], ""));
	$durata = returnare_data(round(formula_incrementare($rez2["timp_constr"], $nivel_cladire-1, $rez2["formula_inc_nivel"], "")), "0");
   if ($mod == "status") {
	echo '<div style="float: left; margin-right: 10px; height: 90px; width: 100px; text-align: center;"><img src="img/bdg_'.$rez2["avatar"].'" /></div>';
	echo '<div style="float: left; text-align: left;"><strong>'.$rez2["nume"].'</strong><br>';
	if ($rez2["nume"] != "Construire")
	{
	echo 'Nivel: '.$nivel_cladire.'<br><br>';
	echo '<a href="javascript:void(0)" onclick="javascript:actiuni(0, \'upgrade\', \''.$nume_cladire.'\'); returnare_planeta();" onMouseOver="javascript:animatie_but(\'but_upgrade\', 1)" onMouseOut="javascript:animatie_but(\'but_upgrade\', 0)"><img id="but_upgrade" src="img/but_upgrade.gif" alt="demolare" border="0" align="absmiddle" /> Upgrade la nivelul '.$nivel_upgrade.'</a><br />';
	echo '<a href="javascript:void(0)" onclick="javascript:actiuni(0, \'demolare\', \''.$nume_cladire.'\');" onMouseOver="javascript:animatie_but(\'but_demolare\', 1)" onMouseOut="javascript:animatie_but(\'but_demolare\', 0)"><img id="but_demolare" src="img/but_demolare.gif" alt="demolare" border="0" align="absmiddle" /> Demolare un nivel</a></div>';
	echo '<a href="javascript:void(0)" onclick="javascript:optiuni_structura(\''.$nume_cladire.'\');" onMouseOver="javascript:animatie_but(\'but_demolare\', 1)" onMouseOut="javascript:animatie_but(\'but_demolare\', 0)"><img id="but_demolare" src="img/but_demolare.gif" alt="optiuni" border="0" align="absmiddle" /> Optiuni</a></div>';
	}
	}
	elseif ($mod == "cerinte")
	{
	echo '<strong>Cerinte upgradare: </strong><br>';
	echo 'Minerale: '.$cost_minerale.'<br>';
	echo 'Gaz: '.$cost_gaz.'<br>';
	echo 'Durata: '.$durata;
	}
	/*
    echo '<a href="javascript:void(0)" onclick="javascript:actiuni(0, \'upgrade\', \''.$nume_cladire.'\'); returnare_planeta();" onMouseOver="javascript:animatie_but(\'but_upgrade\', 1)" onMouseOut="javascript:animatie_but(\'but_upgrade\', 0)"><img id="but_upgrade" src="img/but_upgrade.gif" alt="demolare" border="0" align="absmiddle" /> Upgrade la nivelul '.$nivel_upgrade.'</a><br />';
	echo '<a href="javascript:void(0)" onclick="javascript:actiuni(0, \'demolare\', \''.$nume_cladire.'\');" onMouseOver="javascript:animatie_but(\'but_demolare\', 1)" onMouseOut="javascript:animatie_but(\'but_demolare\', 0)"><img id="but_demolare" src="img/but_demolare.gif" alt="demolare" border="0" align="absmiddle" /> Demolare un nivel</a></div>';
	echo '<a href="javascript:void(0)" onclick="javascript:optiuni_structura(\''.$nume_cladire.'\');" onMouseOver="javascript:animatie_but(\'but_demolare\', 1)" onMouseOut="javascript:animatie_but(\'but_demolare\', 0)"><img id="but_demolare" src="img/but_demolare.gif" alt="optiuni" border="0" align="absmiddle" /> Optiuni</a></div>';
	*/
 }
 else
 echo "<img src='img/logo.gif' border='0' width='200' height'100'>";
 
 mysql_close($db);
 
?>